﻿using System;
namespace DriveManagement
{
    [Serializable]
    public class DriveInfo
    {
        private string fileName;
        private string deviceName;
        private char letter;
        private Int64 totalSize;
        private bool mounted;

        public DriveInfo(string fileName, char letter, Int64 size, string device)
        {   //on mounting
            this.fileName = fileName;
            this.letter = letter;
            totalSize = size;
            deviceName = device;
            mounted = true;
        }

        public DriveInfo(string fileName, char letter)
        {//on deserializetion
            mounted = false;
            this.fileName = fileName;
            this.letter = letter;
        }
        public bool Mounted
        {
            get { return mounted; }
            set { mounted = value; }
        }

        public char Letter
        {
            get { return letter; }
        }

        public Int64 Size
        {
            get { return totalSize; }
        }
        public string FileName
        {
            get { return fileName; }
        }
        public string Device
        {
            get { return deviceName; }
        }

        public string FileNameWithoutExtension
        {
            get
            {
                string[] tokens = fileName.Split(new char[] { '\\', '.' });
                return tokens[tokens.Length - 2];
            }
        }
    }
}
